package main

import (
	"io/ioutil"

	"github.com/urfave/cli/v2"
)

const jsonSample = `{
  "model": {
    "name": "Dict",
    "graphql_name": "illuminant_dict",
    "fields": [
      {
        "name": "id",
        "type": "String",
        "is_required": true,
        "not_insert": true,
        "not_update": true
      },
      {
        "name": "catagory",
        "type": "String",
        "title": "类别",
        "is_search": true,
        "is_column": true,
        "page_ctrl": "text",
        "page_require_msg": "请输入类别",
        "is_page_required": true
      },
      {
        "name": "key",
        "type": "String",
        "title": "键",
        "is_search": true,
        "is_column": true,
        "page_ctrl": "text",
        "page_require_msg": "请输入字典的键",
        "is_page_required": true
      },
      {
        "name": "val",
        "type": "String",
        "title": "值",
        "is_search": true,
        "is_column": true,
        "page_ctrl": "text",
        "page_require_msg": "请输入字典的值",
        "is_page_required": true
      },
      {
        "name": "comment",
        "type": "String",
        "title": "备注",
        "is_column": true,
        "page_ctrl": "text",
        "is_page_required": false
      }
    ]
  },
  "page": {
    "title": "列表",
    "api_import": "@/services/dict/"
  }
}
`

func jsonSampleCmd() *cli.Command {
	return &cli.Command{
		Name: "json",
		Action: func(c *cli.Context) error {
			return ioutil.WriteFile("./curd.json", []byte(jsonSample), 0644)
		},
	}
}
